package wondersgroup.hsswidget.adapter;

import android.content.Context;
import android.widget.ArrayAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * <b>Project:</b> View Test<br>
 * <b>Create Date:</b> 2016/9/26 0026<br>
 * <b>Author:</b> huang saisai <br>
 * <b>Description:</b> <br>
 */
public class AdapterUtil {

    public static ArrayAdapter<String> createStringAdapter(Context context, List<String> data) {
        ArrayAdapter<String> adapter = new ArrayAdapter<String>(
                context,
                android.R.layout.simple_list_item_1,//只能有一个定义了id的TextView
                android.R.id.text1,
                data);//data既可以是数组，也可以是List集合
        return  adapter;
    }

    public static  List<String>  createStringList(int size){
        List<String> list = new ArrayList<String>();
        for (int i =0;i <size ; i++){
            list.add(String.valueOf(i));
        }
        return  list;
    }

}
